package com.example.cqh_votesys.controller;

import com.example.cqh_votesys.pojo.DTO.RegisterDTO;
import com.example.cqh_votesys.pojo.result.Result;
import com.example.cqh_votesys.sevice.RegisterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: pollux
 * @CreateTime: 2024-06-30
 * @Description: 注册控制类
 * @Version: 1.0
 */

@RestController
@RequestMapping()
@Slf4j
@CrossOrigin(origins = "*")
public class RegisterController {

    @Autowired
    private RegisterService registerService;

    /**
     * @param registerDTO 注册DTO类
     * @description: 注册接口
     * @return:
     * @author: pollux
     * @date: 2024/6/30 13:04
     */
    @PostMapping("/register")
    public Result<String> register(@RequestBody RegisterDTO registerDTO){
        log.info("注册接口，{}",registerDTO);
        registerService.register(registerDTO);
        return Result.success("注册成功");

    }
}
